package ModelLayer;
import java.util.ArrayList;

/**
 * Class OrderContainer
 * 
 * Class to hold orders.
 * uses the singleton pattern design.
 * 
 * @author (Morten Søndergaard) 
 * @version (28052013)
 */
public class OrderContainer
{
    // instance variables - replace the example below with your own
    private static OrderContainer instance;
    private ArrayList<Order> orders;
    

    /**
     * Constructor for objects of class OrderContainer
     */
    private OrderContainer()
    {
        orders = new ArrayList<Order>();           
    }
    
    /**
     * Method to fetch the instance of the class.
     * made to comply with singleton pattern
     */
    
    public static OrderContainer getInstance()
    {
        if(instance == null)
        {
            instance = new OrderContainer();
        }
        return instance;
    }

    /**
     * Method to adding a Order object to the ArrayList of Orders in the container
     * 
     * @param  o Order object to be stored in the container
     * @param o     a Order object   
     * @return      the newly created Order object - added to the ArrayList<Order> orders.
     */
    public void addOrder(Order o)
    {
        orders.add(o);               
    }
}
